<?php include "../db/db_connect.php"; ?>
<?php include "../global_variables.php"; ?>

<form action="common/host/host_reservation.php" method="post" class="niceform" >
    <div id="calendar">
    <?php
//get class into the page
require_once('../calendar/tc_calendar.php');


//instantiate class and set properties
$myCalendar = new tc_calendar("date1", true);
$myCalendar->setIcon("../calendar/images/iconCalendar.gif");
$myCalendar->setDate(1, 1, 2000);

//output the calendar
$myCalendar->writeScript();	  
?>
</form>
    </div>
    <table class="sortable" id="dataintable">
        <tr>
            <th width=\"4%\">
            <th>IP</th>
			<th>Name</th>
			<th>Location</th>
			<th>OS</th>
			<th>CPU</th>
			<th>Memory</th>
			<th>HDD</th>
			<th>NA Build</th>
			<th>SART Build</th>
			<th>Status</th>	
		</tr>	
	
<?php	
	$qry = "select host_ip, host_name, location, os, cpu, memory, harddisk, user_name, na_build_id, sart_build_id, status from host_view";
	if (isset($_GET["user"])) {
	    $qry = $qry . " where user_name='{$_GET['user']}'";
	}
	$ds  = mysql_query($qry, $con);
	while ($data = mysql_fetch_array($ds)) {
		$host_ip = $data['host_ip'];
		$host_name = $data['host_name'];
		$host_location = $data['location'];
		$host_os = $data['os'];
		$host_cpu = $data['cpu'];
		$host_memory = $data['memory'];
		$host_hdd = $data['harddisk'];
		$user_name = $data['user_name'];
		$na_build = $data['na_build_id'];
		$sart_build = $data['sart_build_id'];
		$host_status = $data['status'];
		
		$checkbox = "<input type=\"checkbox\" name=\"HostSelection[]\" value=\"{$host_ip}\" style=\"float:left\" />";
		if ($user_name != "UNKNOWN") {
		    $checkbox = "<input type=\"checkbox\" name=\"HostSelection[]\" value=\"{$host_ip}\" style=\"float:left\" disabled=\"disabled\" />";
		}
						
		echo "<tr>
		        <td>{$checkbox}</td>
				<td>{$host_ip}</td>
				<td>{$host_name}</td>
				<td>{$host_location}</td>
				<td>{$host_os}</td>
				<td>{$host_cpu}</td>
				<td>{$host_memory}</td>
				<td>{$host_hdd}</td>
				<td>{$na_build}</td>
				<td>{$sart_build}</td>
				<td><img src=\"{$HOST_STATUS[$host_status]['IMAGE']}\" title=\"{$HOST_STATUS[$host_status]['TITLE']}\" /></td>
			  </tr>\n";
		}
?>
    </table>
    <br />
    <input type="submit" name="reserve" value="Reserve" />
</form>
				
<?php include "../db/db_close.php"; ?>